<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        canvas{
            border: 1px solid #1100cc;
        }


    </style>
</head>
<body>
    <Canvas id="c1" width="600" height="400">
        当前浏览器不支持canvas，请下载最新的浏览器
    </Canvas>

    <script>
        /** @type {HTMLCanvasElement}**/
        var c1 = document.getElementById("c1");
        if(!c1.getContext){
            console.log('当前浏览器不支持canvas，请下载最新浏览器')
        }
        var ctx = c1.getContext('2d');

        ctx.moveTo(240,300);
        ctx.quadraticCurveTo(150,300,150,200);
        ctx.quadraticCurveTo(150,100,300,100);
        ctx.quadraticCurveTo(500,100,500,200);
        ctx.quadraticCurveTo(500,300,300,300);
        ctx.quadraticCurveTo(300,350,200,370);
        ctx.quadraticCurveTo(250,350,240,300);
        ctx.lineWidth=20;
        ctx.stroke();
        ctx.clip();

        let img = new Image();
        img.src = './img/p1.webp';
        img.onload = function(){
            ctx.drawImage(img,200,0,900,700,0,0,600,400)
        }



    </script>
</body>
</html>